<?php
/**
 * Created by PhpStorm.
 * User: qingyun
 * Date: 17/5/2
 * Time: 上午10:07
 */
namespace Admin\Controller;


use Common\Controller\AdminBaseController;

class PosterspaceController extends AdminBaseController{
    public function index(){
        $poster = M('posterspace');
        $list = $poster->select();
        $this->assign('list',$list);
        $this->display();
    }
    public function savespace(){
        if(IS_POST){
            $result = D('Posterspace')->addMenu(I('post.'));
            $this->ajaxReturn($result);
        }
    }
    public function Del(){
        if(IS_POST){
            $result = D('Posterspace');
            $this->ajaxReturn($result->del(I('post.id/d',0)));
        }
    }
    public function getMenu(){
        if(IS_POST){
            $result = D('Posterspace')->menuList(I('post.id/d',0));
            $this->ajaxReturn($result);
        }
    }
//    public function savespace(){
//        if(IS_POST){
//            $title = I('post.title/s','');
//            if(empty($title)){
//                $this->ajaxReturn(['status' => 1,'msg' => '版块名称不能为空']);
//            }
//            $num = M('poster_space')->field('id')->where(['name' => $title])->count();
//            if($num > 0){
//                $this->ajaxReturn(['status' => 1,'msg' => '版块名称不能重复']);
//            }
//            $type = I('post.type/s','banner');
//            $width = I('post.width/d',0);
//            $height = I('post.height/d',0);
//            $description = I('post.description/s','');
//        }
//    }
}